package deposit.main;

import java.util.Date;

/**
 * A class for calculating simple deposit
 */
public class SimpleDeposit extends Deposit {

    /**
     * Default constructor
     */
    public SimpleDeposit() {
	super();
    }

    /**
     * Constructor with sets the parameters of deposit
     */
    public SimpleDeposit(String bank, String depoId, Date startDate,
	    int dayLong, double sum, double interestRate) {
	super(bank, depoId, startDate, dayLong, sum, interestRate);
    }

    public double getInterest() {
	if (interest > ZERO) {
	    return interest;
	}

	double dayCf = dayLong;
	int daysInDepositYear = getDaysInDepositYear();
	interest = sum * (interestRate / 100.0) * (dayCf / daysInDepositYear);
	return interest;
    }
}